let object = { a: [{ b: { c: 3 } }] };
// let [err, result] = takeValue(object, "a[0].b.c");
let [err, result] = takeValue(object, 'a[0].d.c');
console.log(err, result); // => null, 3
function takeValue(originObj, key) {
    try{
        return  [null,eval(`originObj.${key}`)] 
    }catch(error){
        return [error,null]
        
    }
 
}
